package com.digitalchina.lxnsy.api;

import android.app.Activity;
import android.os.Handler;

import com.digitalchina.lxnsy.constant.MSG;
import com.digitalchina.lxnsy.constant.URL;
import com.digitalchina.lxnsy.toolkit.OkHttpUtil;
import com.digitalchina.lxnsy.xml.UserXML;
import com.lzy.okhttputils.model.HttpParams;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.api
 * 创建人：郑皓
 * 创建时间：2018/8/6 14:47
 * 修改备注：
 * ================================================
 */
public class BusinessInformation {

    /**
     * 资讯分类列表
     *
     * @param activity
     * @param handler
     */
    public static void getInformationList(Activity activity, Handler handler) {

        HttpParams params = new HttpParams();
        OkHttpUtil.get(activity, URL.URL_GET_INFOMATION_LIST, "", params, handler, MSG.MSG_GET_INFOMATION_LIST_SUCCESS, MSG.MSG_GET_INFOMATION_LIST_FIELD);

    }

    /**
     * 资讯列表
     *
     * @param activity
     * @param typeId   类型ID(typeId为1时查询首页资讯)
     * @param handler
     */
    public static void getInformationListByType(Activity activity, String typeId, int page, int limit,String queryDataType, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("newsTypeId", typeId);
        params.put("page", String.valueOf(page));
        params.put("perPage", String.valueOf(limit));
        params.put("queryDataType", queryDataType);
        OkHttpUtil.get(activity, URL.URL_GET_INFOMATION_LIST_BY_TYPE, "", params, handler, MSG.MSG_GET_INFOMATION_LIST_BY_TYPE_SUCCESS, MSG.MSG_GET_INFOMATION_LIST_BY_TYPE_FIELD);

    }


    /**
     * 资讯详情
     *
     * @param activity
     * @param id       资讯id
     * @param handler
     */
    public static void getInfoDetailById(Activity activity, String id, Handler handler) {

        HttpParams params = new HttpParams();

        OkHttpUtil.get(activity, URL.URL_GET_INFO_DETAIL_BY_ID+id, "", params, handler, MSG.MSG_GET_INFOMATION_DETAIL_SUCCESS, MSG.MSG_GET_INFOMATION_DETAIL_FIELD);

    }


}
